/*
* binds behaviors to ajax searchresult when they appear
 */
bindQuickresultsBehaviours = function () {
	if(!isOpera) {
		$('#quickresults a').fadeTo('slow', 0.8);
		$('#quickresults a').hover(quickresultHover, quickresultRelease);
	}

	$('#quickresults').slideDown('slow');

	$('#quickresults .hide').bind('click', function() {
		$('#quickresults').slideUp('slow');
		quicksearchBlur();
	});
}

/*
 * replaces searchbutton by hourglass to show that search is in progress
 */
startAjaxSearch = function () {
	$('#quicksearch').css('background-image', 'url(/images/layout/hourglass.gif)');
}

/*
 * transform searchbox when focussed for better usability
 */
quicksearchFocus = function () {
	$('#quicksearch').addClass('focussed');
	$('#quicksearchform').css('background-image', 'none');
	$('#quicksearch').val('');
	$('#quicksearchform .button').css('display', 'none');

	if (isIE && browserVersion == 6) {
		$('#quicksearch').animate({width:100, height:18}, 400, 'easeinout');
	} else {
		$('#quicksearch').animate({width:150, height:18}, 400, 'easeinout');
	}
}

/*
 * transform searchbox when released for better looks
 */
quicksearchBlur = function () {
	$('#quicksearch').css('background-image', 'none');
	$('#quicksearch').animate({width:85, height:12}, 400, 'easeinout', function () {
		$('#quicksearch').removeClass('focussed');
		$('#quicksearch').val('Suche');
		$('#quicksearchform .button').css('display', 'inline');
		$('#quicksearchform').css('background-image', 'url(/images/layout/searchbox.jpg)');
	});
}

/*
 * highlight hovered ajax result
 */
quickresultHover = function () {
	$(this).fadeTo('quick', 1);
}

/*
 * release hovered ajax result
 */
quickresultRelease = function () {
	$(this).fadeTo('quick', 0.8);
}

/*
 * do ajax search while typing
 */
quicksearchTyping = function () {
	ajax_qsearch.call('quicksearch','quickresults');
}